{include file="header.html"}

<div class="page-header">
	<h6>
		优惠劵管理
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			优惠劵列表
		</small>
	</h6>
</div>

<form class="form-inline" action="?" method="get">
<input type="hidden" name="app" id="app" value="coupon" />
<input type="hidden" name="act" id="act" value="index" />
<input type="text" placeholder="关键词" name="keyword" value="{$keyword}" />
<input type="text" name="begin_time" id="begin_time" placeholder="开始日期" value="{$begin_time}" autocomplete="off"/>
<span class="some-span">-</span>
<input type="text" name="end_time" id="end_time" placeholder="结束日期" value="{$end_time}" autocomplete="off"/>
<button type="submit" class="btn btn-info btn-sm">
	<i class="ace-icon fa fa-search bigger-110"></i>搜索
</button>
</form>

<div class="table-content">
<table id="simple-table" class="table table-striped table-bordered table-hover">
	<thead>
		<tr>
			<th>ID</th>
			<th>优惠名称</th>
			<th>面值</th>
			<th>使用条件</th>
			<th>领取条件</th>
			<th>发放总量</th>
			<th>每人限领数量</th>
			<th>类型</th>
			<th>是否限制部分使用</th>
			<th>状态</th>
			<th>有效时间</th>
			<th>添加时间</th>
			<th>操作</th>
		</tr>
	</thead>

	<tbody>
		{foreach from = $rs item=row}
		<tr>
			<td>{$row->id}</td>
			<td><a href="?app=coupon&act=edit&id={$row->id}" title="{$row->name}">{$row->name|truncate:10}</a></td>
			<td>{if $row->coupon_money<0}全额{else}{$row->coupon_money}{/if}</td>
			<td>{if $row->min_price>0}满 {$row->min_price}使用{else}无条件{/if}</td>
			<td>{if $row->man_price>0}满 {$row->man_price}领取{else}{/if}</td>
			<td><a href="?app=coupon&act=sn&coupon_id={$row->id}" target="_blank">{$row->sn}</a>{if $row->auto_add==1} (自动增加){/if}</td>
			<td>{$row->num_per_person}</td>
			<td>{if $row->type==0}商品优惠券
				{else if $row->type==1}品牌优惠券
				{else if $row->type==2}新人注册券
				{/if}</td>
			<td>{if $row->permit_goods>0}是
				{else if $row->permit_goods==0}否
				{/if}</td>
			<td>{if $row->status==1}显示{else}隐藏{/if}</td>
			<td>{if $row->handy_time>0} 获取后{$row->handy_time}天有效{elseif $row->begin_time>0}{date('Y-m-d', $row->begin_time)} - {/if}{if $row->handy_time>0}{elseif $row->end_time>0}{date('Y-m-d', $row->end_time)}{else}无限期{/if}</td>
			<td>{date('Y-m-d', $row->add_time)}</td>
			<td>
				<a href="?app=coupon&act=edit&id={$row->id}">
					<button type="button" class="btn btn-xs btn-info">
					<i class="ace-icon fa fa-pencil bigger-120"></i>
				</button>
				</a>
				<a href="?app=coupon&act=delete&id={$row->id}" class="delete">
					<button type="button" class="btn btn-xs btn-danger">
					<i class="ace-icon fa fa-trash-o bigger-120"></i>
				</button>
				</a>
			</td>
		</tr>
		{foreachelse}
		<tr bgcolor="white"><td colspan="13" height="50">暂无记录</td></tr>
		{/foreach}

	</tbody>
</table>
</div>
<div class="mypage">
	共 {$page.num_records} 个记录  {$page.current_page} / {$page.num_pages} 页  {$page.first_page} {$page.prev} {$page.nav} {$page.next} {$page.last_page}
</div>
{include file="footer.html"}
<script>
$(function(){
	$('#begin_time').datepicker();
	$('#end_time').datepicker();
});
</script>